package org.yoki.edu.common.protocol.radius.attribute.attr.type;


import org.yoki.edu.common.protocol.radius.attribute.attr.RadiusMsgAttr;
import org.yoki.edu.common.utils.bytes.ByteUtils;

/**
 * @author Sky$
 * @Description: TODO
 * @date 2018/1/16$ 17:59$
 */
public abstract class StringTypeAttr extends RadiusMsgAttr<String> {

    @Override
    protected String parseValue(byte[] input) {
        return ByteUtils.getUtf8String(input);
    }

    @Override
    protected byte[] getValueBytes() {
        if (null == value || value.length() <= 0) {
            return null;
        }
        return ByteUtils.getUtf8Byte(value);
    }

    public static void main(String[] args) {
        byte[] bytes = "18380220741".getBytes() ;
        for(byte b : bytes){
            System.out.println(b + " ");
        }
    }

}
